<?php
class BoardsController extends AppController {
    	var $name = 'Boards';
	var $components = array('Session');
     
        
        function index($id='1')
        {
            $this->Board->id=$id;
            $options['contain']=array('Post'=>
                array('order'=>"Post.created DESC", 'Tag', 'Comment'=>array(
                    'limit' => 3, 'conditions' => array('parent_id'=>0), 'order'=> 'Comment.up', 'Tag')
                    ));
            
//            'limit' => 200
//            $options['contain']['Post']['conditions']['order']='Post.up';
            $this->set('com', $this->Board->find('first', $options));
//            $this->set('com','hi');
            }
        function onchange($id='1', $sort="Post.created", $newcom="") {
            $this->layout = "none";
            $this->Board->id=$id;
            $options['contain']=array('Post'=>
                array('order'=>$sort." DESC",'Tag', 'Comment'=>array(
                    'limit' => 3, 'conditions' => array('parent_id'=>0), 'order'=> 'Comment.up', 'Tag')
                    ));
//            $options['Post']['conditions']['order']=$sort;
            $this->set('com', $this->Board->find('first', $options));
        }
    }


?>